# Makefile for
# mapwin WITHOUT lua
#
# --------------------------------------------------------------------

PROGRAM = mapwin.exe

CFILES  = animprev.c blocked.c import.c mapcust.c mapdia.c maped.c mapfunc.c mapwin.c
OFILES  = $(CFILES:.c=.o)
DFILES  = $(CFILES:.c=.d)  # dependency files, so we only recompile
									# when needed, even if includes change

CFLAGS  = -O2 -Wall
LFLAGS  = -mwindows

LIB     = -lddraw -ldxguid

# --------------------------------------------------------------------

$(PROGRAM): $(OFILES)
	windres mapwin.rc -o mapwinrc.o
	gcc $(LFLAGS) -o $@ $(OFILES) mapwinrc.o $(LIB)

%.o: %.c
	gcc $(CFLAGS) -MMD -o $@ -c  $<

# read dependency information, in case include files changed, so all
# c files including the changed file get recompiled

-include $(DFILES)

.PHONY: clean
clean:
	rm -f *.o *.d *.exe
